<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jq-3.6.0.js"></script>
    <style>
        .box {
            height: 100px;
            width: 100px;
            background-color: green;
        }
        
        .red {
            background-color: red;
        }
    </style>
</head>

<body>
    <button class="bn1">点击变红色</button>
    <button class="bn2">返回原来的颜色</button>
    <button class="bn3">切换颜色</button>
    <div class="box"></div>
</body>
<script>
    $('.bn1').click(function() {
        $('.box').addClass('red')
    })
    $('.bn2').click(function() {
        $('.box').removeClass('red')
    })
    $('.bn3').click(function() {
        $('.box').toggleClass('red');
    })
</script>

</html>